import request from '@/utils/request'

const menuApi = {
    permossionApi: "/api/app/permission"
}


class Service {
    static postMenuData(data){
        return request({
            url: menuApi.permossionApi,
            method: 'patch',
            json: true,
            data
          }).then((res) => {
            if (res.code === 200) {
              return Promise.resolve(res)
            }
            return Promise.reject(res)
          })
    }


    static getMenuData(){
        return request({
            url: menuApi.permossionApi,
            method: 'get',
            json: true
          }).then((res) => {
            if (res.code === 200) {
              return Promise.resolve(res)
            }
            return Promise.reject(res)
          })
    }



    static putMenuData(data){
        return request({
            url: menuApi.permossionApi,
            method: 'put',
            json: true,
            data
          }).then((res) => {
            if (res.code === 200) {
              return Promise.resolve(res)
            }
            return Promise.reject(res)
          })
    }


    static deleteMenuData(i){
        return request({
            url: `/api/app/permission?id=${i}`,
            method: 'delete',
            json: true
          }).then((res) => {
            if (res.code === 200) {
              return Promise.resolve(res)
            }
            return Promise.reject(res)
          })
    }
}

export default Service
